package com.mingke.db.Dao;

import com.mingke.db.Entity.SchemaTableColumn;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SchemaInterface {

    @Select("select SCHEMA_NAME from information_schema.SCHEMATA")
    public List<String> listSchemas();

    @Select("select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA = #{schemaName}")
    public List<String> listTables(String schemaName);

    @Select("select COLUMN_NAME, DATA_TYPE, COLUMN_KEY, COLUMN_COMMENT from information_schema.COLUMNS where TABLE_NAME = #{tableName}")
    public List<SchemaTableColumn> listTableColumns(String tableName);
}
